﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace MDS
{
    public class IOPVCache
    {
        private static Dictionary<String, double> dic = new Dictionary<String, double>();
        public static void SetIOPV(string stkId, double iopv)
        {
            Contract.Requires(!string.IsNullOrEmpty(stkId)); 
            dic[stkId] = iopv;
        }
        public static double GetIOPV(string stkId)
        {
            Contract.Requires(!string.IsNullOrEmpty(stkId)); 
            Contract.Requires(stkId.EndsWith("1"));
            string  tmpStkId= stkId.Substring(0, stkId.Length - 1) + "0";
            if (dic.ContainsKey(tmpStkId))
                return dic[tmpStkId];
            else
            {
                Log.Debug("获取IOPV出错");
                return 0;
            }
        }
    }
}
